﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace QiHe
{
    public partial class Add_User_Tech : Form
    {
        DataSet DeptList;

        
        public Add_User_Tech()
        {
            InitializeComponent();

        }

        private void Add_User_Load(object sender, EventArgs e)
        {
            MedEQ.Service1 sop = new MedEQ.Service1();
            DeptList = sop.HSP_Department_List(DataTemp.HSPID);

            comboBox1.DataSource = DeptList.Tables[0];
            comboBox1.DisplayMember = "Name";
            comboBox1.ValueMember = "DeptNumber";
        }

        private void button1_Click(object sender, EventArgs e)
        {
            MedEQ.Service1 sop = new MedEQ.Service1();
            string result = sop.Add_User(textBox1.Text, textBox3.Text, textBox2.Text, textBox1.Text, comboBox1.SelectedValue.ToString(), "2");

            if (result.Equals("3"))
                MessageBox.Show("用户名已存在！");
            if (result.Equals("4"))
                MessageBox.Show("中文名已存在！");
            if (result.Length > 2)
            {
                MessageBox.Show(result.ToString());
                this.Dispose();

            }
        }
    }
}
